﻿using oceanho.webapi.factory.httpCore.Binder;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Web;
using oceanho.webapi.factory.Tests.Entity;

namespace oceanho.webapi.factory.Tests.AppCode
{
    /// <summary>
    /// 自定义绑定实现参数实现演示类（IBinder）
    /// </summary>
    internal class AppDefaultBinder : IBinder
    {
        /// <summary>
        /// 实现IBinder接口的GetModel方法
        /// </summary>
        /// <param name="paramterInfo"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        public object GetModel(ParameterInfo paramterInfo, HttpContext context)
        {
            if (paramterInfo.ParameterType == typeof(User))
            {
                return new User()
                {
                    id = 1800,
                    age = 15,
                    name = "我是通过自定义绑定出来的参数对象!"
                };
            }
            return null;
        }
    }
}
